import { createRouter, createWebHistory } from "vue-router";

export default createRouter({
    history: createWebHistory(),
    // 滚动行为：控制路由跳转后滚动条位置
    scrollBehavior: () => ({ left: 0, top: 0 }),
    routes: [
        {
            path: "/",
            redirect: "/home",
        },
        {
            path: "/home",
            name: "home",
            meta: {
                title: '首页'
            },
            component: () => import("@/pages/home/index.vue"),
        },
        {
            path: "/wxlogin",
            name: "wxlogin",
            meta: {
                title: '微信登录'
            },
            component: () => import("@/pages/wxlogin/index.vue"),
        },
        {
            path: "/hospital",
            name: "hospital",
            component: () => import("@/pages/hospital/index.vue"),
            children: [{
                name: "register",
                path: 'register',
                component: () => import('@/pages/hospital/register/index.vue'),
                meta: {
                    title: '预约挂号'
                }
            },
            {
                path: 'register_step1',
                name: "register_step1",
                component: () => import('@/pages/hospital/register/register_step1.vue'),
                meta:{
                    title:'预约第一步'
                }
            },
            {
                path: 'register_step2',
                name: "register_step2",
                component: () => import('@/pages/hospital/register/register_step2.vue'),
                meta:{
                    title:'预约第二步'
                }
            },
            {
                path: "detail",
                name: "hospitalDetail",
                component: () => import("@/pages/hospital/detail/index.vue"),
                meta: {
                    title: '医院详情'
                },
            },
            {
                path: 'notice',
                component: () => import('@/pages/hospital/notice/index.vue'),
                meta: {
                    title: '预约通知'
                }
            },
            {
                path: 'close',
                component: () => import('@/pages/hospital/close/index.vue'),
                meta: {
                    title: '停诊信息'
                }
            },
            {
                path: 'search',
                component: () => import('@/pages/hospital/search/index.vue'),
                meta: {
                    title: '查询'
                }
            },
            ],
        },
        {
            path: "/user",
            name: "user",
            component: () => import("@/pages/user/index.vue"),
            children: [{
                name: "patient",
                path: 'patient',
                component: () => import('@/pages/user/patient/index.vue'),
                meta: {
                    title: '就诊人'
                }
            },{
                name: "order",
                path: 'order',
                component: () => import('@/pages/user/order/index.vue'),
                meta: {
                    title: '挂号订单'
                }
            },{
                name: "certification",
                path: 'certification',
                component: () => import('@/pages/user/certification/index.vue'),
                meta: {
                    title: '实名认证'
                }
            },{
                name: "profile",
                path: 'profile',
                component: () => import('@/pages/user/profile/index.vue'),
                meta: {
                    title: '账号信息'
                }
            },{
                name: "feedback",
                path: 'feedback',
                component: () => import('@/pages/user/feedback/index.vue'),
                meta: {
                    title: '意见反馈'
                }
            },
            ]
        },
    ],
});